import { _decorator, Canvas, Component, Node, ResolutionPolicy, screen, UITransform, view, Widget } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('AutoCanvas')
export class AutoCanvas extends Component {
  canvas: Canvas;
  canvasWid: Widget;
  start() {
    // this.canvas = this.node.getComponent(Canvas);
    // this.canvasWid = this.node.getComponent(Widget);
    // const viewSize = view.getVisibleSize();
    // const fixSize = {
    //   width: 720,
    //   height: 1334,
    // };
    // const targetSize = {
    //   width: (fixSize.width / fixSize.height) * viewSize.height,
    //   height: viewSize.height,
    // };
    // const side = viewSize.width > targetSize.width ? (viewSize.width - targetSize.width) / 2 : (targetSize.width - viewSize.width) / 2;
    // this.canvasWid.left = viewSize.width > targetSize.width ? (viewSize.width - targetSize.width) / 2 : 0;
    // this.canvasWid.right = viewSize.width > targetSize.width ? (viewSize.width - targetSize.width) / 2 : 0;
    // this.canvasWid.updateAlignment();
  }
}
